package com.itheima.service;


import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.dao.ClearOrderDao;
import com.itheima.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@Service
@Transactional
public class ClearOrderServiceImpl implements ClearOrderService {

    @Autowired
    ClearOrderDao clearOrderDao;


    @Override
    public void deleteLastMonthOrder() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String firstDayLastMonth = simpleDateFormat.format(DateUtils.getFirstDay4LastMonth());
        String lastDayLastMonth = simpleDateFormat.format(DateUtils.getLastDay4LastMonth());
        clearOrderDao.deleteLastMonthOrder(firstDayLastMonth,lastDayLastMonth);

    }


}
